// 邮箱
export const isEmail = (s) => {
  return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
}

// 手机号
export const isMobile = (s) => {
  return /^1[0-9]{10}$/.test(s)
}

// 电话号码
export const isPhone = (s) => {
  return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s)
}

// 身份证号
export const isIdCard = (s) => {
  return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(s)
}

// 邮政编码
export const isPostal = (s) => {
  return /[1-9]\d{5}(?!\d)/.test(s)
}

// QQ 号
export const isQQ = (s) => {
  return /^[1-9][0-9]{4,9}$/.test(s);
}

// 人民币
export const isMoney = (s) => {
  return /^\d*(?:\.\d{0,2})?$/.test(s);
}

// IP
export const isIP = (s) => {
  return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(s);
}

// 日期时间
export const isDate = (s) => {
  return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(s) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(s)
}

// 数字
export const isNum = (s) => {
  return /^[0-9]$/.test(s);
}

// 英文
export const isEng = (s) => {
  return /^[a-zA-Z]+$/.test(s);
}

// 中文
export const isChinese = (s) => {
  return /^[\\u4E00-\\u9FA5]+$/.test(s);
}

// 小写
export const isLower = (s) => {
  return /^[a-z]+$/.test(s);
}

// 大写
export const isUpper = (s) => {
  return /^[A-Z]+$/.test(s);
}

// HTML
export const isHtml = (s) => {
  return /<("[^"]*"|'[^']*'|[^'">])*>/.test(s);
}
